package com.hehe.controller;


import com.hehe.Dao.Select_Mapper;
import com.hehe.POJO.Tb_user;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping(value="/select")
public class Select {

    @Autowired
    private Select_Mapper select_mapper;

    @Value("${config_file_name}")
    private String config_file_name;
    
    @GetMapping(value="/all" )
    @ResponseBody
    public List<Tb_user> get_All(Model model){
        List<Tb_user> all_user = select_mapper.get_all();
        return all_user;
    }




    @GetMapping(value = "/show_databases")
    @ResponseBody
    public String index(Model model) {
        List<String> strings = select_mapper.showDatabases();
        return "<h1>" + strings + "</h1>";
    }


    @GetMapping(value = "/config")
    @ResponseBody
    public String get(Model model) {
        return "<h1>" + config_file_name + "</h1>";
    }


}




